<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="vr_header">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <link th:href="@{/static/icon/cake1.png}" rel="shortcut icon"/><!-- 自定义页签图标 -->

    <title>蛋挞的主页</title>

    <!-- Bootstrap core CSS -->
    <link th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet"/>
    <!-- Bootstrap theme -->
    <link th:href="@{/static/css/bootstrap-theme.min.css}" rel="stylesheet"/>
    <!-- Bootstrap theme -->
    <link th:href="@{/static/css/common.css}" rel="stylesheet"/>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="http://v3.bootcss.com/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet"/>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <script src="http://v3.bootcss.com/assets/js/ie-emulation-modes-warning.js"></script>

    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.3.0/respond.min.js"></script>
    <script th:src="@{/static/js/jquery.min.js}"></script>
    <script th:src="@{/static/js/jquery.cookie.js}"></script>
    <script th:src="@{/static/js/bootstrap.min.js}"></script>
    <script th:src="@{/static/js/jquery.form.js}"></script>
    <script th:src="@{/static/js/jquery.enplaceholder.js}"></script>
</head>
<body>
    <div class="center-block" style="width:366px; height:300px; margin-top: 15%; border-style: groove; border-color:deepskyblue"><!--suppress ALL-->
        <div style="width:366px; height:52px; background-image: url('/DMIL/static/images/login_submit_hover.png'); background-repeat:no-repeat; border:none; background-color: transparent;">
            <div style=" color:white; font-family: 微软雅黑; font-size:22px; margin-top: 0px; padding-top:2%; padding-left: 5%">进入蛋挞的主页</div>
            <!-- 账号密码登录 -->
            <div id="vrpass" style="width:350px; height:50px; padding-left:0px; padding-top:50px;">
                <div style="width:300px; height:50px; padding-right:0px;"><!--suppress ALL-->
                    <span class="input-group-addon" style="height:30px; margin-left:20px; margin-top:15px; float:left; background-image: url('/DMIL/static/images/login_username.png'); background-repeat:no-repeat; border:none; background-color: transparent;"></span>
                    <input type="text" id="passport" name="passport" class="form-control" placeholder="输入我的生日（如：1月1日）" maxlength="50"
                           Style="height:50px; margin-top:15px; margin-left:65px; padding:6px 12px; top:0px; position:relative; width:80%;"
                           required="" autofocus="">
                </div><!--suppress ALL-->
                <button id="loginbtn" class="btn btn-lg" type="button" onclick="checkpass()"
                        style="width:90%; margin-left:20px; margin-top:10%; color:white; font-family: 微软雅黑; font-size:20px; background-image:url('/DMIL/static/images/login_submit.png'); background-repeat:no-repeat;">
                    进入主页
                </button>

            </div>
        </div>
    </div>

<script th:src="@{/static/js/common.js}"></script>
<script type="text/javascript">

    //回车执行功能
    document.onkeydown = function(e) {
        var e = e || event;
        if(e.keyCode == 13) {
            checkpass();
        }
    }

    //验证并登录
    function checkpass() {
        var passport = $("#passport").val();
        if (passport.length == 0) {
            alert("请输入通行码！");
            $("#passport").focus();
            return;
        }
        $.ajax({
            type: "POST"
            , url: "/DMIL/personal/goPass"
            , data: {
                passport: passport
            }
            , contentType: "application/x-www-form-urlencoded;charset=utf-8;"
            , dataType: "json"
            , cache: false
            , success: function (data) {
                if (data.obj1 == 'success') {
                    console.log("输入正确！");
                    //登陆成功跳转到设备管理
                    location.href="/DMIL/personal/page";
                } else {
                    alert(data.obj1);
                }
            }
            , error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert("服务器异常！");
            }
        });
    }
</script>
</body>
</html>